package com.example.figurehecheng.controller.merchant;


import com.example.figurehecheng.common.result.Result;

import com.example.figurehecheng.domain.dto.VenuesDTO;
import com.example.figurehecheng.domain.vo.VenuesVO;
import com.example.figurehecheng.service.IVenuesService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 场馆信息表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-04
 */
@RestController("adminVenuesController")
@RequestMapping("/admin/venues")
@CrossOrigin
@RequiredArgsConstructor
public class VenuesController {

    @Autowired
    private IVenuesService venuesService;

    /**
     * 创建场馆
     * @param
     * @return
     */
    @PostMapping("/create")
    @ApiOperation("创建场馆")
    public Result<Long> createVenues(@RequestBody @Valid VenuesDTO dto){
        Long vehicleId= venuesService.createVenues(dto);
        return Result.success(vehicleId);
    }
    /**
     * 获取商家场馆列表
     * @param
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("获取商家场馆列表")
    public Result<List<VenuesVO>> getVenuesList(){
         List<VenuesVO> list=venuesService.getVenuesList();
        return Result.success(list);
    }
    /**
     * 获取商家场馆详情
     * @param
     * @return
     */
    @GetMapping("/info")
    @ApiOperation("获取商家场馆详情")
    public Result<VenuesVO> getVenuesInfo(){
        VenuesVO venuesvo=venuesService.getVenuesByMid();
        return Result.success(venuesvo);
    }
    /**
     * 修改商家场馆信息
     * @param
     * @return
     */
    @PutMapping("/update")
    @ApiOperation("修改商家场馆信息")
    public Result<Boolean> updateVenues(@RequestBody @Valid VenuesDTO dto){
        boolean update=venuesService.updateVenues(dto);
        return Result.success(update);
    }
}
